package com.xueyi.aixihu.entity.dto;

import com.xueyi.aixihu.reqeust.base.PageLimitReq;
import lombok.Data;
import org.springframework.util.StringUtils;

import javax.validation.constraints.NotNull;

/**
 * @author 俞烨
 * @version 1.0
 * @description: 新闻
 * @date 2023/12/19 14:39
 */
@Data
public class NewsDto extends PageLimitReq {
    private String title;
    private String monthTime;
    private String maxMonthTime;
    private Integer contentType;
    private String areaType;
    private String fromToAreaIds;
    private String areaTypeStr;
    @NotNull(message = "页面类型不能为空")
    private Integer pageType;
    private Integer isAlreadyProcess;

    public void format() {
        isAlreadyProcess = isAlreadyProcess == null ? 0 : isAlreadyProcess;
        title = StringUtils.hasLength(title) ? title : null;
        monthTime = StringUtils.hasLength(monthTime) ? monthTime : null;
        areaType = StringUtils.hasLength(areaType) ? areaType : null;
        areaTypeStr = StringUtils.hasLength(areaTypeStr) ? areaTypeStr : null;
        fromToAreaIds = StringUtils.hasLength(fromToAreaIds) ? fromToAreaIds : null;
    }
}
